import Mock from 'mockjs'

const result = (current: number,pageSize: number) => 
  Mock.mock({ 
      total: 55,
      [`list|${pageSize}`]: [{
        id: '@guid',
        name: '@cname',
        'gender|1': ['male', 'female'],
        email: '@email',
        disabled: false
      }],
    status:0
    })
    interface ProductList {
      id: string;
      name: string;
      gender: "male" | "female";
      email: string;
      disabled: boolean;
    }

async function queryProductList (params: {
  current: number;
  pageSize: number;
  gender?: string;
}): Promise<{ total: number; list: ProductList[] }>  {
  return new Promise(resolve => {
    setTimeout(() => {
      resolve(result(params.current, params.pageSize))
    },1000)
  })
}
async function removeProducts (params: {
  current: number;
  pageSize: number;
  gender?: string;
}): Promise<{ total: number; list: ProductList[] }> {
  return new Promise(resolve => {
    setTimeout(() => {
      resolve(result(params.current, params.pageSize))
    },1000)
  })
}



export { queryProductList, removeProducts }